//
//  define.h
//  giuseppe
//
//  Created by Apple on 15/7/14.
//  Copyright (c) 2015年 GiantUmbrella. All rights reserved.
//

#ifndef giuseppe_define_h
#define giuseppe_define_h

#pragma mark  测试连接凯帆 
//#define uHostURL @"http:/192.168.20.7:8080/yldj-cms/app/"  //测试
//http://192.168.20.7:8080/yldj-cms/app/dwgl/getHomePagePic
//#define uIcon @"http://192.168.20.7:8080/yldj-cms/" //用户头像
//#define uPathURL @"http://192.168.20.7:8080/web.files" //拼接路径

#pragma mark  服务器 
//郝峰峰
//#define uHostURL        @"http://192.168.20.34:8080/"
//#define uHostURL_IMAGE  @"http://192.168.20.34:8080"


//测试服务器
//#define uHostURL             @"http://192.168.20.241:9999/"
//#define uHostURL_IMAGE       @"http://192.168.20.241:9999"

//外网
#define uHostURL             @"http://117.22.253.34:9014/"
#define uHostURL_IMAGE       @"http://117.22.253.34:9014"
//人工智能id
//#define LOGOID               @"402894177215e605017215f64f410017"
//弥尔社区id
#define LOGOID               @"40289471724ffe52017272bff1fa0173"

//引导页
#define getAppGuide          @"appRest/getAppGuide"
//欢迎界面
#define getAppWelcome        @"appRest/getAppWelcome"
//登录
#define getAppLogin          @"appRest/getAppLogin"
//导航页
#define getAppNavigate       @"appRest/getAppNavigate"
//菜单栏
#define getAppMenu           @"appRest/getAppMenu"
//获取logo
#define getAppLogo           @"appRest/getAppLogo"


/**
 *  textfile输入框 评论
 */

#define Device_Width  [[UIScreen mainScreen] bounds].size.width//获取屏幕宽高
#define Device_Height [[UIScreen mainScreen] bounds].size.height

#define NAVH (MAX(Device_Width, Device_Height)  == 812 ? 88 : 64)
#define TABBARH (MAX(Device_Width, Device_Height)  == 812 ? 83 : 49)

#define LXColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define LXRandomColor LXColor(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))

#import "UILabel+LXLabel.h"
#import "UIColor+Expanded.h"
#import "LxButton.h"
#import "UILabel+LXVerticalStyle.h"
#import "UIView+LX_Frame.h"
#import "NSString+XHDateFormat.h"
#import "EPProgressHUD.h"
#import "HttpRequest.h"
#import "Common.h"
#import "WKFTime.h"
#import "WKFHelper.h"
#import "WKFNetwork.h"
#import "JSONKit.h"
#import "UIColor+UIColor_Hex.h"
#import "MBProgressHUD+SGQRCode.h"
#import "MBProgressHUD.h"
#import "MJExtension.h"
#import "ZYImageCacheManager.h"
#import "DataCheck.h"
#import "BaseVC.h"
#import "Masonry.h"
#import "ChangePasswordFile.h"
#import "SVProgressHUD.h"
#import "SVProgressHUD+Extension.h"
#import "UIViewController+GeneralMethod.h"
#import "HttpTool.h"
#import "HttpRequest.h"
#import "EPProgressHUD.h"
#import "SDWebImageManager.h"
/*************************************/

/**
 *  判断字符串是否为空
 */

#define KIsBlankString(str)  [NSString isBlankString:str]

#define  IsEmptyStr(string) string == nil || string == NULL ||[string isKindOfClass:[NSNull class]]|| [string isEqualToString:@""] ||[[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0 ? YES : NO

#define isEmptyDic(dic) dic == nil && [dic isKindOfClass:[NSNull class]] && array.count == 0 ? YES : NO

#define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height

#define ScreenW [UIScreen mainScreen].bounds.size.width
#define ScreenH [UIScreen mainScreen].bounds.size.height

#define UIColorWithRGBA(r,g,b,a)        [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]

#define SCREEN_WIDTH_SCALE SCREEN_WIDTH / 375.0
#define SCREEN_HEIGHT_SCALE SCREEN_HEIGHT / 667.0

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)

#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)

#define UIColorRGBA(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]


#define BACKGROUNDCOLOR [UIColor colorWithRed:239.0/255.0 green:34.0/255.0 blue:109.0/255.0 alpha:1.0]
#define TextColor [UIColor colorWithRed:51.0/255.0 green:51.0/255.0 blue:51.0/255.0 alpha:1.0]

//线条描边
#define GrayLine [UIColor colorWithRed:221.0/255.0 green:221.0/255.0 blue:221.0/255.0 alpha:1.0]

#define DarkGrayLine [UIColor colorWithRed:140.0/255.0 green:140.0/255.0 blue:140.0/255.0 alpha:1.0]
#define ThemeColor [UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1.0]

#define NotNilAndNull(_ref) (((_ref) != nil) && (![(_ref)isEqual:[NSNull null]]))
#define IsNilOrNull(_ref) (((_ref) == nil) || ([_ref] isEqual:[NSNull null]))

#define IsAvailableString(_ref)   (((_ref) != nil) && (![(_ref) isEqual:[NSNull null]]) && ([_ref isKindOfClass:[NSString class]]) && (_ref.length > 0))
#define WS(weakSelf)        __weak __typeof(&*self)weakSelf = self


#define IDXTO 20

/**
 *比例关系 宽
 */
#define  PROPORTION_WIDTH [UIScreen mainScreen].bounds.size.width/760
/**
 *比例关系 高
 */
#define  PROPORTION_HEIGHT [UIScreen mainScreen].bounds.size.height/1340


//宽
#define DesignW 760

#define DesignH  1340

//用户信息宏定义
#define AppVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]

#define ISLOGIN [[[NSUserDefaults standardUserDefaults]objectForKey:@"loginfrom"] intValue]


#define STATUS_HEIGHT [[UIApplication sharedApplication]statusBarFrame].size.height

///** 支付宝信息*/
//#define PAYSTYLE_AlipayPartner @"2088421644889648";
//#define PAYSTYLE_AlipaySeller @"shbnwl@163.com";
//#define PAYSTYLE_AlipayPrivateKey @"MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAL3jiP4W1+KSfobQRz+Tz19FVwZuxjctMUoqtz5VnPWqUT+2wLaLkgH5nHFrjS2Nc/EuTNnqlIZyeJsnTtyRNZ7WneLmehqVoic6/6iZmUTt4I1ipUybwBsjEWVF/MaHlKQ/1RAhSE8ZaNDzxh/cnLy7eKtDPUIKncwwgJwJ40A5AgMBAAECgYEAoRdc6qIad75r1JbxOsB8lohOschcJAcU36SpXBppVAgvcWvqxXJWZZKK47WoSVLNX3g1/lEBu6V1J7sLLheKckK9Kj9Wmow+nbK93vI1BOOA8kNtwKvULUCtxUFA1qEKG6xR7kGY8GePsoMd2+B5gxf7zTPHlMvyZcyUNMVV0nkCQQD7MDRMeycoimIC3piYaKMdup5SvbIMDi+MtwgygldydtCDp1FJOaw3SfCOplmONM1fb+Th4w+ArpMiAv7JRfPTAkEAwYa50zBZKbJAQ2ASWkJdDnmnUpPZBxN7+IGyA83eH+8Dv6b88TOLuG5gj8dA5PwN0N1B0bURnnJQS6gWyQPQQwJALJ8Bi1yNNjxu8MeOH/TmlQ9jtJsSF+YlOEADasWQtzq4C8sbO4DNQP0XiJ+wZPyoRv3fkOj/BgL9DBuwGx0cFQJAexA8XMKzAGPcn7uZEBKBcHIF5+oiqXBHdkirNeYU6UOpo5cB5DP+FoMCHov7hWGPO5FniH5XPOW+j83M53joVwJBALT+yVXO64lNCRuZb649anhoSa7v7JA4Jqi5WsqIPy+8Loy6Itj06sY1s24DFIA29z4VupHi5BUUXblEWCtzjuE=";
//
//#define WXAPPID @"wx3303ab3183bb15e3"
//#define WXAPPSWCRET @"e23365c7577a75526c14164e97fa8141"
//
//
////微信支付
//#define WXAPP_ID   @"wx8155a5d6f7901c0a"  //APPID
//
//#define PAYSTYLE_WXAPP_ID          @"wx8155a5d6f7901c0a"               //APPID
//#define PAYSTYLE_WXAPP_SECRET      @"" //appsecret
////商户号，填写商户对应参数
//#define PAYSTYLE_WXMCH_ID          @"1296995101"
////商户API密钥，填写相应参数
//#define PAYSTYLE_WXPARTNER_ID      @"jiaxingmangzuwenhuachuangyi02015"
////支付结果回调页面
//
//#define PAYSTYLE_WXNOTIFY_URL      @"http://adaa.ketao.com/api/wxpay/notify.php"
//
////获取服务器端支付数据地址（商户自定义）
//#define PAYSTYLE_WXSP_URL          @"http://wxpay.weixin.qq.com/pub_v2/app/app_pay.php"

#define MJDuration 2.0

/**
 *  宏ZXLog
 */
#if DEBUG
#define HGLog(FORMAT, ...) fprintf(stderr,"\nfunction:%s line:%d content:%s\n", __FUNCTION__, __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define HGLog(FORMAT, ...) nil
#endif

#define MJDuration 2.0

#define kNavbarHeight ((kDeviceVersion>=7.0)? 64 :44 )
#define kIOS7DELTA   ((kDeviceVersion>=7.0)? 20 :0 )
#define kTabBarHeight 49

#define kDeviceVersion [[UIDevice currentDevice].systemVersion floatValue]
//#define WS(weakSelf) __weak __typeof(&*self)weakSelf = self;

/**
 *  RGB颜色
 */
#define RXDColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]

/**
 *  随机色
 */
#define RXDRandomColor RXDColor(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))

#define TABBAR_COLOR  RXDColor(20, 22, 23)//tabbar颜色

#define COLOR_LINEANDTEXT  RXDColor(255, 72, 101)//导航栏颜色  tabbar颜色

#define COLOR_BUTTON  RXDColor(180, 0, 0)//各个按钮颜色

#define COLOR_BUTTON_UNSELECTED RXDColor(221, 221,221) //各个按钮颜色 未点亮的时候

#define COLOR_PROMPTTEXT RXDColor(255, 186, 0) //提示文字颜色

#define COLOR_KUANG RXDColor(71, 71, 71)  //一些框的背景颜色 如登录注册


#define NAVI_COLOR  RXDColor(187, 163, 127)//导航栏颜色

#define COLOR_LINGHTGRAY RXDColor(247, 247, 247)//浅灰颜色

/**
 * 每个页面背景的颜色
 */
#define COLOR_EVERYVIEWBG  RXDColor(45, 45, 45)
/**
 *那些横线的颜色
 */
#define COLOR_Line  RXDColor(22, 22, 22)

/**
 *黄色文字的颜色
 */
#define COLOR_TEXT  RXDColor(250, 221, 96)

/**
 *导航栏文字的颜色
 */
#define COLOR_TEXT6  RXDColor(102, 102, 102)

/**
 *字体大小
 */
#define Font_SIZE_14 14

/**
 *字体大小
 */
#define Font_SIZE_18 18
/**
 *  导航栏高度
 */
#define NAVGATIONHEIGHT 64

#define CellMargin 5

#define RXDNAVI_WIDTH 44

#define LEFT_SPACING 30*PROPORTION_WIDTH//距离左侧的间距


#define RECT(x, y, width, height) CGRectMake((x), (y), (width), (height))

#define POINT(x, y) CGPointMake((x), (y))

#define SIZE(width, height) CGSizeMake((width), (height))

#define kScreenSizeHeight                    [[UIScreen mainScreen] bounds].size.height
#define kScreenSizeWidth                     [[UIScreen mainScreen] bounds].size.width
#define kScreenSizeHeight_NoStatusbar        ([[UIScreen mainScreen] bounds].size.height - 20)

//手机型号
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)

#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)

//UMeng
#define UmengAppkey @"5735a18d67e58e6bd10019c1"



//天诚云移动过来的
#define uSystemVersion          @"uSystemVersion"   //主版本号

//时间格式
#define uDateNotificationTimeLine @"yyyy-MM-dd HH:mm"
#define uDateNotificationSignTmen @"yyyy-MM-dd"
#define uDateNotificationTitle    @"MM月dd日"


//网络相关
#define uTimeOut            15.0f
#define uHttpMethod         @"POST"
#define uNetLoading         @"加载中..."
#define uNetLoadSuccess     @"加载成功"
#define uNetNoData          @"暂无数据"
#define uNetNoMore          @"暂无更多数据"
#define uNetErrorTimeOut    @"网络请求超时 请稍后再试"
#define uNetErrorDataError  @"提交失败 请稍后再试"
#define uNetError           @"网络出错 请稍后再试"

#define kIsFirstRun             @"kIsFirstRun"       //是否第一次启动  @"YES"/空 是第一次启动  ; @"NO" 不是
/**
 *  用户信息
 */
#define kUser_Integral          @"kUser_Integral" //用户积分
#define kUser_Info              @"kUser_Info"           //用户总信息
#define kUser_key                @"kUser_key"              //userId
#define kUser_name              @"kUser_name"            //用户名
#define kUser_RegID             @"kUser_RegID"           //推送ID
#define kUser_pass              @"kUser_pass"            //用户密码
#define kUser_defined_avatar    @"kUser_defined_avatar"  //用户头像
#define kUser_isLogin           @"kUser_isLogin"         //用户是否登录


/**
 * 屏幕适配--iPhoneX iPhoneXR  iPhoneXS_MAX全系
 */
#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhoneXR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhoneXS_Max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) : NO)

/**
 * 屏幕适配--iPhoneX全系
 */
#define kiPhoneXAll ([UIScreen mainScreen].bounds.size.height == 812 || [UIScreen mainScreen].bounds.size.height == 896)

/**
 * iPhoneX全系导航栏增加高度 (64->88)
 */
#define kiPhoneX_Top_Height (([UIScreen mainScreen].bounds.size.height == 812 || [UIScreen mainScreen].bounds.size.height == 896)?24:0)

/**
 * iPhoneX全系TabBar增加高度 (49->83)
 */
#define kiPhoneX_Bottom_Height  (([UIScreen mainScreen].bounds.size.height == 812 || [UIScreen mainScreen].bounds.size.height == 896)?34:0)

//注意的是:针对继承自UIScrollView的，需要处理一下内边距
//第一步：关闭自动调整内边距
//if (@available(iOS 11.0, *)) {
//    [UIScrollView appearance].contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
//}
//
////第二步：在使用的地方手动设置内边距
//self.scrollView.contentInset = UIEdgeInsetsMake(0, 0, kBottomBarHeight, 0);
////这样设置以后，底下的触摸区域就能正常显示内容了，而且当UIScrollView滑到最底部的时候，不会被遮住。


//wkf  Definition
#define mSCREEN_WITH     (float)(320)/(float)320*[[UIScreen mainScreen]bounds].size.width

#define mSCREEN_HEIGHT     (float)(320)/(float)320*[[UIScreen mainScreen]bounds].size.height

#define TimeLineCellHighlightedColor [UIColor colorWithRed:92/255.0 green:140/255.0 blue:193/255.0 alpha:1.0]
#define SDColor(r, g, b, a) [UIColor colorWithRed:(r / 255.0) green:(g / 255.0) blue:(b / 255.0) alpha:a]
#define TimeLineCellHighlightedColor [UIColor colorWithRed:92/255.0 green:140/255.0 blue:193/255.0 alpha:1.0]
//测试token
#define TOKEN @"12345565465454"
#define LOAD_FAIL @"网络不稳定，请稍候再试！"
#define LOAD_SUCCESS @"加载成功"
#define LC_SHOW_FAIL(LOAD_FAIL) [LCProgressHUD showFailure:LOAD_FAIL];
#define LC_SHOW_SUCCESS(LOAD_SUCCESS) [LCProgressHUD showFailure:LOAD_SUCCESS];


#define LC_HIDEN [LCProgressHUD hide];
#define LC_LOADING [LCProgressHUD showLoading:nil];
#define LC_Loading(string) [LCProgressHUD showLoading:string];

//提示成功
#define LCSUCCESS_ALSERT(stirng) [XHToast showCenterWithText:stirng];
//失败提示
#define LCFAIL_ALERT(string)[XHToast showCenterWithText:string];

#define UISCREEN_BOUNDS_SIZE      [UIScreen mainScreen].bounds.size // 屏幕的物理尺寸

#define MOMENT_LIMIT_COUNTS   20

#define _WEAK_SELF __weak __typeof(&*self)weakSelf = self;

#define SEND_USER_PHOTO_MAX_COUNTS 3

// 带RGB参数生成Color的宏定义
#define COLOR_WITH_RGB(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]
#define COLOR_MORE_VIEW_BACKGROUND COLOR_WITH_RGB(240, 240, 240)

#define USER_LIBRARY_DIRECTORY [NSHomeDirectory() stringByAppendingPathComponent:@"Library/DB"]
#define USER_DOCUMENTS_DIRECTORY [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Image"]
#define USER_DOCUMENTS_DIRECTORY_AVATAR [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Avatar"]


#define MESSAGE_TEXT_FONT     [UIFont systemFontOfSize:16.0] // 消息文本字体的字体大小
#define PROMPT_WAITING_VIEW_TAG             1102    // 提示view 遮罩层TAG
#define PROMPT_WAITING_LODING_WEB_TAG             1103    // 提示view 遮罩层TAG

#define MAX_IMAGE_LENGHT  600
#define MIN_IMAGE_LENGHT  300
#define THUBNIAL_HEIGHT   100
#define DAY_TIME          24*60*60

#define IMAGE_SCALE_SHORTEST_LENGTH_720      720 // 普通图片缩放时最短边的长度

#define MMS_THUMBNAIL_SCALE_LENGTH_120     120 // MMS缩略图缩放时最长边的长度
#define MMS_THUMBNAIL_SHORTEST_LENGTH_43    43 // MMS缩略图缩放时最短边的长度

// thumbwidth：服务器缩略图边长。目前公网支持180，564，内网支持300，564
#define MOMENT_SERVER_THUMBNAIL_WIDTH  180
// thumbwidth：缩略图最长边，按照图片宽高的最大值进行等比例缩放。
#define MOMENT_THUMBNAIL_MIN_WIDTH  UISCREEN_BOUNDS_SIZE.width
// thumbwidth：缩略图最短边
#define MOMENT_SINGLE_THUMBNAIL_MIN_WIDTH  UISCREEN_BOUNDS_SIZE.width*0.11

#define NOTIFICATION_CHANGE_TAB_IMAGE           @"ChangeTabImage"        // 改变tab图的通知
#define NOTIFICATION_UPDATE_IMAGE           @"updateImage"        // 刷新图片


// 图片媒体类型
#define PUBLIC_IMAGE               @"public.image"

//设备判断
#define IS_IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
#define IS_IOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8)

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)

#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)

// 设置   颜色
#define TSEColor(r, g, b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1.0f]
#define TSEAColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]

//获取设备的物理高度
#define ScreenHeight [UIScreen mainScreen].bounds.size.height
//获取设备的物理宽度
#define ScreenWidth [UIScreen mainScreen].bounds.size.width

#define ScreenWidth5S 320
#define ScreenWidth6 375
#define ScreenWidth6plus 414

//调试模式下输入，发布后不再输入。
#ifdef DEBUG
#define DLog(fmt, ...) NSLog((@"[文件名:%s]\n" "[函数名:%s]\n" "[行号:%d] \n" fmt), __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
#define DeBugLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#define NSLog(...) NSLog(__VA_ARGS__);
#define MyNSLog(FORMAT, ...) fprintf(stderr,"[%s]:[line %d行] %s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define DLog(...)
#define DeBugLog(...)
#define NSLog(...)
#define MyNSLog(FORMAT, ...) nil
#endif


// 加载图片
#define PNGIMAGE(NAME)          [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:@"png"]]
#define JPGIMAGE(NAME)          [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:@"jpg"]]
#define IMAGE(NAME, EXT)        [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:(EXT)]]


// RGB颜色转换（16进制->10进制）

#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]


// View 坐标(x,y)和宽高(width,height)
#define ViewWidth(v)                        v.frame.size.width
#define ViewHeight(v)                       v.frame.size.height
#define ViewX(v)                            v.frame.origin.x
#define ViewY(v)                            v.frame.origin.y
#define SelfViewHeight                      self.view.bounds.size.height
#define RectX(f)                            f.origin.x
#define RectY(f)                            f.origin.y
#define RectWidth(f)                        f.size.width
#define RectHeight(f)                       f.size.height
#define RectSetWidth(f, w)                  CGRectMake(RectX(f), RectY(f), w, RectHeight(f))
#define RectSetHeight(f, h)                 CGRectMake(RectX(f), RectY(f), RectWidth(f), h)
#define RectSetX(f, x)                      CGRectMake(x, RectY(f), RectWidth(f), RectHeight(f))
#define RectSetY(f, y)                      CGRectMake(RectX(f), y, RectWidth(f), RectHeight(f))
#define RectSetSize(f, w, h)                CGRectMake(RectX(f), RectY(f), w, h)
#define RectSetOrigin(f, x, y)              CGRectMake(x, y, RectWidth(f), RectHeight(f))
#define Rect(x, y, w, h)                    CGRectMake(x, y, w, h)
#define DATE_COMPONENTS                     NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit
#define TIME_COMPONENTS                     NSHourCalendarUnit|NSMinuteCalendarUnit|NSSecondCalendarUnit
#define FlushPool(p)                        [p drain]; p = [[NSAutoreleasePool alloc] init]
#define StatusBarHeight                     [UIApplication sharedApplication].statusBarFrame.size.height
#define SelfDefaultToolbarHeight            self.navigationController.navigationBar.frame.size.height

#define Size(w, h)                          CGSizeMake(w, h)
#define Point(x, y)                         CGPointMake(x, y)


#define TabBarHeight                        49.0f
#define NaviBarHeight                       44.0f
#define HeightFor4InchScreen                568.0f
#define HeightFor3p5InchScreen              480.0f

#define ViewCtrlTopBarHeight                (IsiOS7Later ? (NaviBarHeight + StatusBarHeight) : NaviBarHeight)
#define IsUseIOS7SystemSwipeGoBack          (IsiOS7Later ? YES : NO)


//---------界面跳转-------
#define POP_NAVIGATION_NUM(num) [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:(self.navigationController.viewControllers.count - (num))] animated:YES];



//EPMacro_Function.h
#define uFont       @"FZLanTingHei-L-GBK-M"
#define uFont_B     @"Helvetica-Bold"
#define uFont_Stheiti @"STHeitiSC-Light" //黑体

//weakself
#define mWEAKSELF __typeof(self) __weak weakSelf = self;

//version 版本号 1.0.0
#define mVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
//Bundle version 编译号
#define mBundleVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]

#define DEGREES_TO_RADIANS(angle) ((angle)/180.0 *M_PI)

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)

#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)
#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)


#define iOS7Later ([UIDevice currentDevice].systemVersion.floatValue >= 7.0f)
#define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f)
#define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f)
#define iOS9_1Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.1f)
#define iOS11Later ([UIDevice currentDevice].systemVersion.floatValue >= 11.0f)

//坐标
#define mCGRect(x,y,width,height) CGRectMake(x, y, width, height)
#define mDeviceWidth [UIScreen mainScreen].bounds.size.width        //屏幕宽
#define mDeviceHeight [UIScreen mainScreen].bounds.size.height      //屏幕高
#define mScreenThree (KDeviceHeight==480?YES:NO)                    //3.5英寸
#define mScreenFour (KDeviceHeight==568?YES:NO)                     //4英寸

#define uSystemAddHeight  (([[[UIDevice currentDevice] systemVersion] doubleValue] <7.0) ? 20 : 0) //如果是小于7.0,增加高度制为20
#define uHeightTabbar       49 //底部bar的高度
//版本
#define mSystem70 ([[[UIDevice currentDevice] systemVersion] doubleValue]>=7.0)     //判断系统版本大于7.0
#define mSystem60 ([[[UIDevice currentDevice] systemVersion] doubleValue]<7.0)      //判断系统版本不大于7.0
#define mDeviceSystemVersion [[UIDevice currentDevice].systemVersion doubleValue]   //获得系统版本

#define IOS5 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0f && [[[UIDevice currentDevice] systemVersion] floatValue] < 6.0f)
#define IOS7_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0f)
#define IOS6_7_DELTA(V,X,Y,W,H) if(IOS7_OR_LATER) {CGRect f = V.frame;f.origin.x += X;f.origin.y += Y;f.size.width +=W;f.size.height += H;V.frame=f;}
#define IOS8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0f)


//wipeNull
#define mWipeNull(object) (((NSNull *)object==[NSNull null])?@"":object)

//color
#define mRGB(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:a]
#define mHexRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define mHexRGBAlpha(rgbValue,a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:(a)]
#define fontHightColor mHexRGB(0x1a1a1a) //字体深色
#define fontNomalColor mHexRGB(0x808080) //字体浅色
#define bjBlueColor mHexRGB(0x151f41) //主题蓝色
#define bjColor mHexRGB(0xf7f7f7)  //背景深灰色 mHexRGB(0xe4e4e4):浅灰
#define borderCol mHexRGB(0xe2e2e2)    //border颜色
#define fontHightYelloColor mHexRGB(0xff7800) //字体深黄色


//判断网络连接状态
#define isReachability    [[Reachability reachabilityForInternetConnection] currentReachabilityStatus] != NotReachable


//数据库

#define uTableName_Province              @"uTableName_Province"
#define uTableName_City                  @"uTableName_City"
#define uTableName_Area                  @"uTableName_Area"


//+ (NSString *)isNullToString:(id)string
//{
//    if ([string isEqual:@"NULL"] || [string isKindOfClass:[NSNull class]] || [string isEqual:[NSNull null]] || [string isEqual:NULL] || [[string class] isSubclassOfClass:[NSNull class]] || string == nil || string == NULL || [string isKindOfClass:[NSNull class]] || [[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length]==0 || [string isEqualToString:@"<null>"] || [string isEqualToString:@"(null)"])
//    {
//        return @"";
//
//
//    }else
//    {
//
//        return (NSString *)string;
//    }
//}



// 屏幕尺寸
#define kScreen_WIDTH [UIScreen mainScreen].bounds.size.width
#define kScreen_HEIGHT [UIScreen mainScreen].bounds.size.height

#define SCREEN_RATIO (kScreen_WIDTH/375)

// iPhone机型
#define IS_iPhone5s_Before ((kScreen_WIDTH == 320) ? YES : NO)
#define IS_iPhone6s_Later ((kScreen_WIDTH == 375) ? YES : NO)
#define IS_iPhone6sPlus_Later ((kScreen_WIDTH == 414) ? YES : NO)
#define IS_iPhoneX ((kScreen_WIDTH == 375 && kScreen_HEIGHT == 812) ? YES : NO)

// iPhone版本
#define IS_iOS11_Later (([[UIDevice currentDevice].systemVersion floatValue] >= 11.0) ? YES : NO)

// 系统性参数
#define SYS_StatusBar_HEIGHT ((!IS_iPhoneX) ? 20 : SYS_SafeArea_TOP)
#define SYS_NavigationBar_HEIGHT (SYS_StatusBar_HEIGHT+44)
#define SYS_Toolbar_HEIGHT 44
#define SYS_TabBar_HEIGHT ((!IS_iPhoneX) ? 49 : (49+SYS_SafeArea_BOTTOM))
#define SYS_Spacing_HEIGHT 8

#define SYS_SafeArea_TOP ((IS_iPhoneX) ? 44 : 0)
#define SYS_SafeArea_BOTTOM ((IS_iPhoneX) ? 34 : 0)

// 最小间隔
#define minimumSpacing 10


/*------------------------------字体、颜色------------------------------*/

// 系统颜色
#define SYS_Black_Color [UIColor blackColor]
#define SYS_DarkGray_Color [UIColor darkGrayColor]
#define SYS_LightGray_Color [UIColor lightGrayColor]
#define SYS_White_Color [UIColor whiteColor]
#define SYS_Gray_Color [UIColor grayColor]
#define SYS_Red_Color [UIColor redColor]
#define SYS_Green_Color [UIColor greenColor]
#define SYS_Blue_Color [UIColor blueColor]
#define SYS_Cyan_Color [UIColor cyanColor]
#define SYS_Yellow_Color [UIColor yellowColor]
#define SYS_Magenta_Color [UIColor magentaColor]
#define SYS_Orange_Color [UIColor orangeColor]
#define SYS_Purple_Color [UIColor purpleColor]
#define SYS_Brown_Color [UIColor brownColor]
#define SYS_Clear_Color [UIColor clearColor]
#define SYS_Random_Color [UIColor randomColor]

// 字体
#define AppFont(x) [UIFont systemFontOfSize:x]
#define AppBoldFont(x) [UIFont boldSystemFontOfSize:x]

// 颜色
#define AppColor(r, g, b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]
#define AppAlphaColor(r, g, b, a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]

#define AppHTMLColor(html) [UIColor colorWithHexString:html]


/*------------------------------图片------------------------------*/

#define ImageNamed(name) [UIImage imageNamed:name]
#define URLWithString(url) [NSURL URLWithString:url]


#endif
